package io.renren.modules.sp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.sp.dao.SpTeamNumDao;
import io.renren.modules.sp.dto.SpTeamNumDTO;
import io.renren.modules.sp.entity.SpTeamNumEntity;
import io.renren.modules.sp.service.SpTeamNumService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 代表队人数限制
 *
 * @author whc 15953295779@126.com
 * @since 3.0 2024-05-12
 */
@Service
public class SpTeamNumServiceImpl extends CrudServiceImpl<SpTeamNumDao, SpTeamNumEntity, SpTeamNumDTO> implements SpTeamNumService {

    @Override
    public QueryWrapper<SpTeamNumEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<SpTeamNumEntity> wrapper = new QueryWrapper<>();
        //province
        String province = (String)params.get("province");
        if(StringUtils.isNotBlank(province)){
            wrapper.eq("province", province);
        }

        return wrapper;
    }

    //根据province查询记录
    @Override
    public SpTeamNumEntity getByProvince(String province) {
        QueryWrapper<SpTeamNumEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("province", province);
        SpTeamNumEntity entity = baseDao.selectOne(wrapper);
        return entity;
    }


}